﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace TestApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            // how to convert integer to string
            int x = 123;
            string y = x + "";
            string z = x.ToString();
            string n = Convert.ToString(x);
            string a = string.Empty + x;
            string b = new StringBuilder().Append(x).ToString();
            string c = string.Format("{0}", x);
            comboBox1.SelectedIndex = 0;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text =="")
            {
                textBox1.Text = "0";
                textBox2.Text = "0";
            }
            else
            {
                long n = Convert.ToInt64(textBox1.Text);
                if (comboBox1.SelectedIndex==0)
                {
                    textBox2.Text = Convert.ToString(n, 2);
                }
                else if (comboBox1.SelectedIndex==1)
                {
                    textBox2.Text = Convert.ToString(n, 8);
                }
                else
                {
                    textBox2.Text = Convert.ToString(n, 16).ToUpper();
                }
            }
        }
    }
}
